/**
 * Common KudoStar Functions
 */
package com.kudostar.android.kudostar;

import android.content.Context;
import android.content.Intent;
import android.view.Menu;
import android.view.Menu.Item;

/**
 * @author Mike Luby
 * 
 */
public class KudoCommon {

	final int ACTION_KUDO_ABOUT = 5;
	final int ACTION_KUDO_FRIEND = 1;
	/**
	 * Constants
	 */
	final int ACTION_KUDO_LIST = 0;
	final int ACTION_KUDO_PREF = 4;
	final int ACTION_KUDO_SUBMIT = 2;

	/**
	 * Build The menu
	 */
	public Boolean BuildMenu(Menu menu) {
		menu.add( 0, ACTION_KUDO_LIST, "View Your KudoStars" );
		menu.add( 0, ACTION_KUDO_FRIEND, "View Friend's KudoStars" );
		menu.add( 0, ACTION_KUDO_SUBMIT, "Sumbit KudoStars" );
		menu.add( 0, ACTION_KUDO_PREF, "Preferences" );
		return true;
	}

	/**
	 * Handle Menu Select
	 * 
	 * @param o
	 * @param item
	 * @return
	 */
	public Boolean MenuOptionSelect(Context o, Item item) {
		switch (item.getId( )) {
			case 0:
				this.StartActivity( o, KudoList.class );
				break;
			case 1:
				this.StartActivity( o, KudoList.class );
				break;
			case 2:
				this.StartActivity( o, SubmitKudo.class );
				break;
			case 4:
				this.StartActivity( o, KudoPref.class );
				break;
		}
		return true;
	}

	/**
	 * Start Activity
	 * 
	 * @param o
	 * @param c
	 */
	public void StartActivity(Context o, Class c) {
		o.startActivity( new Intent( o, c ) );
	}
}